package com.itljm.cxrMarket.controller;

import com.itljm.cxrMarket.common.Result;
import com.itljm.cxrMarket.entity.dto.OrderItemProductsDTO;
import com.itljm.cxrMarket.service.OrderItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ljm
 * @date 2024/12/28 18:35
 */
@RestController
@RequestMapping("/orderItem")
public class OrderItemController {
    @Autowired
    private OrderItemsService orderItemsService;

    // 根据订单ID查询该订单的关联商品信息
    @RequestMapping("/findProductsByOrderId")
    public Result findProductIdsByOrderId(Integer orderId) {
        List<OrderItemProductsDTO> productIds = orderItemsService.findOrderItemsProductsByOrderId(orderId);
        return Result.ok(productIds);
    }
}
